﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PhuLeBussinessObject.Core;
using PhuLeDao.News;
using PhuLeBooze.Global;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Script.Serialization;
using System.Xml;
using PhuLeBussinessObject.Base;
using PhuLeDao.Core;
namespace PhuLeBooze.Views.News
{
    public partial class NewsList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //<InputValue UserID="1" SecrectToken=”” ID="1" />
            //IList<CTag> allCloundTabs = new CNewsDao().GetTags(string.Format("<InputValue UserID='{0}' SecrectToken='{1}' RowsPerPage='2000' PageIndex='1'/>", CSecurity.USER_ID, CSecurity.SECRECT_TOKEN));
            //ddlCloundTags.DataSource = allCloundTabs;
            //ddlCloundTags.DataTextField = "Text";
            //ddlCloundTags.DataValueField = "ID";
            //ddlCloundTags.DataBind();
            //ddlCloundTags.Items.Insert(0, new ListItem("(Tất cả)", "-100"));

            //ddlTags.DataSource = allCloundTabs;
            //ddlTags.DataTextField = "Text";
            //ddlTags.DataValueField = "ID";
            //ddlTags.DataBind();
            //ddlTags.Items.Insert(0, new ListItem("(Tất cả)", "-100"));


            IList<CListData> allCate = new CCoreDao().GetListData(string.Format("<InputValue UserID='{0}' SecrectToken='{1}' FunctionCode='MenuCategoryAll'/>", CSecurity.USER_ID, CSecurity.SECRECT_TOKEN));
            string optCate = "";
            foreach (var item in allCate)
            {
                if (item.ParentID > 0)
                    optCate += string.Format("<option value='{0}'>&nbsp;&nbsp;&nbsp;{1}</option>", item.Value, item.Name); 
                else
                    optCate += string.Format("<option value='{0}' style=\"color:red\">{1}</option>", item.Value, item.Name); 
                 
            }
            lblOptionCate.Text=optCate;
            lblOptionCate2.Text=optCate;


            StringBuilder Result = new StringBuilder();
            Result.AppendFormat("var categoryID='{0}';\n", "145");
           Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "CNews",
                               Result.ToString(), true);

        }
    }
}